package com.lfy.kcat.content.controller.ai.controller;

import org.springframework.ai.openai.OpenAiAudioSpeechModel;
import org.springframework.ai.openai.api.OpenAiAudioApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/openai")
@RestController
public class AudioController {

    @Autowired
    private OpenAiAudioSpeechModel openAiAudioSpeechModel;
    @GetMapping(value = "/audio",produces = "audio/mpeg")
    public  byte[] audio(@RequestParam("msg") String message)
    {
        byte[] call = openAiAudioSpeechModel.call(message);
        return call;

    }
}
